﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace FwProject.Migrations.FwProjectAppShopDb
{
    public partial class Update_To_appshop_201808141359 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "contentType",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    Name = table.Column<string>(maxLength: 50, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_contentType", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "contentManage",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    ContnetTypeId = table.Column<Guid>(nullable: false),
                    Title = table.Column<string>(maxLength: 50, nullable: true),
                    Content = table.Column<string>(nullable: true),
                    AccessType = table.Column<byte>(nullable: false),
                    Data = table.Column<string>(nullable: true),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_contentManage", x => x.Id);
                    table.ForeignKey(
                        name: "FK_contentManage_contentType_ContnetTypeId",
                        column: x => x.ContnetTypeId,
                        principalTable: "contentType",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateIndex(
                name: "IX_contentManage_ContnetTypeId",
                table: "contentManage",
                column: "ContnetTypeId");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "contentManage");

            migrationBuilder.DropTable(
                name: "contentType");
        }
    }
}
